{
 "metadata": {
  "name": "limit_examples_advanced"
 },
 "name": "limit_examples_advanced",
 "nbformat": 2,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": true,
     "input": "from sympy import *",
     "language": "python",
     "outputs": [],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": true,
     "input": "x = Symbol(\"x\")",
     "language": "python",
     "outputs": [],
     "prompt_number": 2
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(exp(x)*exp(x**2)*(erf(x+1/exp(x))-erf(x)), x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 3,
       "text": "2/sqrt(pi)"
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "source": "The examples here show the limit computation on exp-log expressions (from Gruntz' thesis pp. 122 to 123)"
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.1"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(x)*(exp(1/x-exp(-x))-exp(1/x))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 4,
       "text": "(-exp(1/x) + exp(-exp(-x) + 1/x))*exp(x)"
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 5,
       "text": "-1"
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.2"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(x)*(exp(1/x+exp(-x)+exp(-x**2)) - exp(1/x-exp(-exp(x))))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 6,
       "text": "(-exp(-exp(-exp(x)) + 1/x) + exp(exp(-x**2) + exp(-x) + 1/x))*exp(x)"
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 7,
       "text": "1"
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.3"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(exp(x-exp(-x))/(1-1/x)) - exp(exp(x))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 8,
       "text": "exp(exp(x - exp(-x))/(1 - 1/x)) - exp(exp(x))"
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 9,
       "text": "oo"
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.4"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(exp(exp(x)/(1-1/x))) - exp(exp(exp(x)/(1-1/x-log(x)**(-log(x)))))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 10,
       "text": "exp(exp(exp(x)/(1 - 1/x))) - exp(exp(exp(x)/(1 - log(x)**(-log(x)) - 1/x)))"
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 11,
       "text": "-oo"
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.5"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(exp(exp(x+exp(-x)))) / exp(exp(exp(x)))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 12,
       "text": "exp(-exp(exp(x)))*exp(exp(exp(x + exp(-x))))"
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 13,
       "text": "oo"
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.6"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(exp(exp(x))) / exp(exp(exp(x-exp(-exp(x)))))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 14,
       "text": "exp(exp(exp(x)))*exp(-exp(exp(x - exp(-exp(x)))))"
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 15,
       "text": "oo"
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.7"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(exp(exp(x))) / exp(exp(exp(x-exp(-exp(exp(x))))))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 16,
       "text": "exp(exp(exp(x)))*exp(-exp(exp(x - exp(-exp(exp(x))))))"
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 17,
       "text": "1"
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.8"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(exp(x)) / exp(exp(x-exp(-exp(exp(x)))))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 18,
       "text": "exp(exp(x))*exp(-exp(x - exp(-exp(exp(x)))))"
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 19,
       "text": "1"
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.9"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "log(x)**2 * exp(sqrt(log(x))*(log(log(x)))**2 * exp(sqrt(log(log(x))) * (log(log(log(x))))**3)) / sqrt(x)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 20,
       "text": "exp(exp(sqrt(log(log(x)))*log(log(log(x)))**3)*sqrt(log(x))*log(log(x))**2)*log(x)**2/sqrt(x)"
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 21,
       "text": "0"
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.10"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "(x*log(x)*(log(x*exp(x)-x**2))**2) / (log(log(x**2+2*exp(exp(3*x**3*log(x))))))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 22,
       "text": "x*log(x)*log(-x**2 + x*exp(x))**2/log(log(x**2 + 2*exp(exp(3*x**3*log(x)))))"
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 23,
       "text": "1/3"
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.11"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "(exp(x*exp(-x)/(exp(-x)+exp(-2*x**2/(x+1)))) - exp(x))/x",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 24,
       "text": "(-exp(x) + exp(x*exp(-x)/(exp(-2*x**2/(x + 1)) + exp(-x))))/x"
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 25,
       "text": "-exp(2)"
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.12"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "(3**x + 5**x)**(1/x)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 26,
       "text": "(3**x + 5**x)**(1/x)"
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 27,
       "text": "5"
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.13"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "x/log(x**(log(x**(log(2)/log(x)))))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 28,
       "text": "x/log(x**log(x**(log(2)/log(x))))"
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 29,
       "text": "oo"
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.14"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(exp(2*log(x**5+x)*log(log(x)))) / exp(exp(10*log(x)*log(log(x))))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 30,
       "text": "exp(-exp(10*log(x)*log(log(x))))*exp(exp(2*log(x**5 + x)*log(log(x))))"
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 31,
       "text": "oo"
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.15"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "4*exp(exp(S(5)/2*x**(-S(5)/7)+ S(21)/8*x**(S(6)/11)+2*x**(-8)+S(54)/17*x**(S(49)/45) ))**8 / (9*log(log(-log(S(4)/3*x**(-S(5)/14))))**(S(7)/6))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 32,
       "text": "4*exp(8*exp(54*x**(49/45)/17 + 21*x**(6/11)/8 + 2/x**8 + 5/(2*x**(5/7))))/(9*log(log(-log(4/(3*x**(5/14)))))**(7/6))"
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 33,
       "text": "oo"
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.16"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "(exp(4*x*exp(-x)/(1/exp(x)+1/exp(2*x**2/(x+1)))) - exp(x)) / exp(x)**4",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 34,
       "text": "(-exp(x) + exp(4*x*exp(-x)/(exp(-2*x**2/(x + 1)) + exp(-x))))*exp(-4*x)"
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 35,
       "text": "1"
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.17"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(x*exp(-x)/(exp(-x)+exp(-2*x**2/(x+1))))/exp(x)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 36,
       "text": "exp(-x)*exp(x*exp(-x)/(exp(-2*x**2/(x + 1)) + exp(-x)))"
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 37,
       "text": "1"
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.18"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "(exp(exp(-x/(1+exp(-x))))*exp(-x/(1+exp(-x/(1+exp(-x)))))*exp(exp(-x+exp(-x/(1+exp(-x)))))) / (exp(-x/(1+exp(-x))))**2 - exp(x) + x",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 38,
       "text": "x - exp(x) + exp(2*x/(1 + exp(-x)))*exp(-x/(1 + exp(-x/(1 + exp(-x)))))*exp(exp(-x/(1 + exp(-x))))*exp(exp(-x + exp(-x/(1 + exp(-x)))))"
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 39,
       "text": "2"
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.19"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "log(x)*(log(log(x)+log(log(x))) - log(log(x))) / (log(log(x)+log(log(log(x)))))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 40,
       "text": "(log(log(x) + log(log(x))) - log(log(x)))*log(x)/log(log(x) + log(log(log(x))))"
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 41,
       "text": "1"
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.20"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp((log(log(x+exp(log(x)*log(log(x)))))) / (log(log(log(exp(x)+x+log(x))))))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 42,
       "text": "exp(log(log(x + exp(log(x)*log(log(x)))))/log(log(log(x + exp(x) + log(x)))))"
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 43,
       "text": "E"
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "markdown",
     "source": "The following examples show limit computation on special functions (from Gruntz' thesis p. 126)"
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.21"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(x)*(sin(1/x+exp(-x))-sin(1/x+exp(-x**2)))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 44,
       "text": "(sin(exp(-x) + 1/x) - sin(exp(-x**2) + 1/x))*exp(x)"
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 45,
       "text": "1"
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.22"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(exp(x)) * (exp(sin(1/x+exp(-exp(x)))) - exp(sin(1/x)))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 46,
       "text": "(-exp(sin(1/x)) + exp(sin(exp(-exp(x)) + 1/x)))*exp(exp(x))"
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 47,
       "text": "1"
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.23"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "(erf(x-exp(-exp(x))) - erf(x)) * exp(exp(x)) * exp(x**2)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 48,
       "text": "(-erf(x) + erf(x - exp(-exp(x))))*exp(x**2)*exp(exp(x))"
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 49,
       "text": "-2/sqrt(pi)"
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.24"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "(Ei(x-exp(-exp(x))) - Ei(x)) *exp(-x)*exp(exp(x))*x",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 50,
       "text": "x*(-Ei(x) + Ei(x - exp(-exp(x))))*exp(-x)*exp(exp(x))"
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 51,
       "text": "-1"
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.25"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp((log(2)+1)*x) * (zeta(x+exp(-x)) - zeta(x))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 52,
       "text": "(-zeta(x) + zeta(x + exp(-x)))*exp(x*(log(2) + 1))"
      }
     ],
     "prompt_number": 52
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "#limit(_, x, oo)",
     "language": "python",
     "outputs": [],
     "prompt_number": 53
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.26"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(x)*(gamma(x+exp(-x)) - gamma(x))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 54,
       "text": "(-gamma(x) + gamma(x + exp(-x)))*exp(x)"
      }
     ],
     "prompt_number": 54
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 55,
       "text": "oo"
      }
     ],
     "prompt_number": 55
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.27"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(gamma(x-exp(-x))*exp(1/x)) - exp(gamma(x))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 56,
       "text": "exp(exp(1/x)*gamma(x - exp(-x))) - exp(gamma(x))"
      }
     ],
     "prompt_number": 56
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "#limit(_, x, oo)",
     "language": "python",
     "outputs": [],
     "prompt_number": 57
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.28"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "(gamma(x+1/gamma(x)) - gamma(x)) / log(x)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 58,
       "text": "(-gamma(x) + gamma(x + 1/gamma(x)))/log(x)"
      }
     ],
     "prompt_number": 58
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 59,
       "text": "1"
      }
     ],
     "prompt_number": 59
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.29"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "x * (gamma(x-1/gamma(x)) - gamma(x) + log(x))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 60,
       "text": "x*(log(x) - gamma(x) + gamma(x - 1/gamma(x)))"
      }
     ],
     "prompt_number": 60
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 61,
       "text": "1/2"
      }
     ],
     "prompt_number": 61
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.30"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "((gamma(x+1/gamma(x)) - gamma(x))/log(x) - cos(1/x))*x*log(x)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 62,
       "text": "x*((-gamma(x) + gamma(x + 1/gamma(x)))/log(x) - cos(1/x))*log(x)"
      }
     ],
     "prompt_number": 62
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 63,
       "text": "-1/2"
      }
     ],
     "prompt_number": 63
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.31"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "gamma(x+1)/sqrt(2*pi) - exp(-x)*(x**(x+S(1)/2) + x**(x-S(1)/2)/12)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 64,
       "text": "-(x**(x - 1/2)/12 + x**(x + 1/2))*exp(-x) + sqrt(2)*gamma(x + 1)/(2*sqrt(pi))"
      }
     ],
     "prompt_number": 64
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 65,
       "text": "oo"
      }
     ],
     "prompt_number": 65
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.32"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "log(gamma(gamma(x)))/exp(x)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 66,
       "text": "exp(-x)*log(gamma(gamma(x)))"
      }
     ],
     "prompt_number": 66
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 67,
       "text": "oo"
      }
     ],
     "prompt_number": 67
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.33"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(exp(digamma(digamma(x))))/x",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 68,
       "text": "exp(exp(polygamma(0, polygamma(0, x))))/x"
      }
     ],
     "prompt_number": 68
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 69,
       "text": "exp(-1/2)"
      }
     ],
     "prompt_number": 69
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.34"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(exp(digamma(log(x))))/x",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 70,
       "text": "exp(exp(polygamma(0, log(x))))/x"
      }
     ],
     "prompt_number": 70
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 71,
       "text": "exp(-1/2)"
      }
     ],
     "prompt_number": 71
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.35"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "exp(exp(exp(digamma(digamma(digamma(x))))))/x",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 72,
       "text": "exp(exp(exp(polygamma(0, polygamma(0, polygamma(0, x))))))/x"
      }
     ],
     "prompt_number": 72
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 73,
       "text": "0"
      }
     ],
     "prompt_number": 73
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.36"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "besselj(2,x)*exp(x*(2*log(2+sqrt(3))-sqrt(3)))*sqrt(x)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 74,
       "text": "sqrt(x)*exp(x*(-sqrt(3) + 2*log(sqrt(3) + 2)))*besselj(2, x)"
      }
     ],
     "prompt_number": 74
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "#limit(_, x, oo)",
     "language": "python",
     "outputs": [],
     "prompt_number": 75
    },
    {
     "cell_type": "markdown",
     "source": "Eqn 8.37"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "Max(x, exp(x))/log(Min(exp(-x), exp(-exp(x))))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 76,
       "text": "Max(x, exp(x))/log(Min(exp(-x), exp(-exp(x))))"
      }
     ],
     "prompt_number": 76
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "#limit(_, x, oo)",
     "language": "python",
     "outputs": [],
     "prompt_number": 77
    },
    {
     "cell_type": "markdown",
     "source": "Some other examples"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "digamma(digamma(digamma(x)))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 78,
       "text": "polygamma(0, polygamma(0, polygamma(0, x)))"
      }
     ],
     "prompt_number": 78
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 79,
       "text": "oo"
      }
     ],
     "prompt_number": 79
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "loggamma(loggamma(x))",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 80,
       "text": "loggamma(loggamma(x))"
      }
     ],
     "prompt_number": 80
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "limit(_, x, oo)",
     "language": "python",
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 81,
       "text": "oo"
      }
     ],
     "prompt_number": 81
    }
   ]
  }
 ]
}